//
//  DataCenter.h
//  Karaoke
//
//  Created by Ka Leung Ke on 11-10-6.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "FMDatabase.h"
#import "FMDatabaseAdditions.h"
#import "AsyncSocket.h"
#import "SongObject.h"

@interface DataCenter : NSObject {
    FMDatabase *db;

    // PreLoad Data
    NSMutableArray      *arrayAllSinger, *arraySingerType, *arraySongType, *arrayLanType;
    NSMutableDictionary *dictForSingerType;
    NSMutableArray      *arrayFavor;
}

@property (retain, nonatomic) NSMutableArray *currentBillListArray;
+ (DataCenter *)sharedInstance;
- (NSMutableArray *)getAllSong:(int)tempCondition;
- (NSMutableArray *)getSongWithInputCode:(NSString *)inputCode tempCondition:(NSString *)tempCondition;
- (NSMutableArray *)getSongListWithSingerId:(NSString *)tempSingerId:(NSString *)tempCondition;
- (NSMutableArray *)getAllSinger;
- (NSMutableArray *)getSingerType;
- (NSMutableArray *)getSingerOfType:(int)tempId;
- (NSMutableArray *)getSingerWithPy:(NSString *)tempPy;
- (NSMutableArray *)getSingerWithName:(NSString *)tempName;
- (NSMutableArray *)getSongType;
- (NSMutableArray *)getLanType;
- (NSMutableArray *)getSongListWithCondition:(NSArray *)tempCondition withRange:(NSRange)tempRange;
- (NSMutableArray *)getSongWithWordCount:(int)count;
- (NSMutableArray *)getSongWithLanguage:(int)languageId:(NSString *)tempCondition:(NSRange)tempRange;
- (NSMutableArray *)getSongListWithType:(int)typeId:(NSString *)tempCondition:(NSRange)tempRange;

// - (int) getTotalRowNumOfSongListWithCondition:(NSMutableArray *)tempConditionArray;
- (int)getTotalRowNumOfSongListWithCondition:(NSArray *)tempCondition;
- (SongObject *)getSongObjectWithSongId:(NSString *)tempSongId;
- (NSMutableArray *)getFavorArray;
- (void)AddSongToFavorWithSongId:(NSString *)tempSongId;
- (void)loadDataAfterReady;
- (void)initDb;

- (void)forwardNoticeCode:(NSString *)tempCode detail:(NSString *)tempDetail;
- (void)addIndexToDb;
- (void)delSongFromFavorWithSongId:(NSString *)tempSongId;
@property (retain, nonatomic) NSString  *clerkNo, *priceId, *roomNo, *printId, *clerkName, *roomType, *UDID,*tempMasterID;
@property (assign, nonatomic) BOOL      canOrder;
@property (retain, nonatomic) NSString  *pageCount;
@property (assign, nonatomic) BOOL      isBoundByRoom;
@property (assign, nonatomic) BOOL      isBoundByClerk;
@end